Ext.define('PJ.view.trainingmanagement.AuditUserList', {
    extend: 'AM.default.DefaultList',
    selModel: {
    },
    alias: ['widget.trainingmanagementAuditUserList'],
    requires: ['AM.default.DefaultSearchForm',
               'AM.default.DateTime', 
               'AM.default.DefaultDateField',
               'AM.default.DefaultDoubleDateField',
               'AM.default.jsonp.DefaultLoadJsonp',//jsonp加载数据
		       'AM.default.DefaultActiveStateCombo',
               'PJ.view.trainingmanagement.AuditClassListAlert'
		      // 'PJ.view.quotamanagement.PlanPlacesList'//计划名额
               ],
               initComponent: function(){
                  	var me= this;
                  	var msgTip;          // 一定要定义在使用前，且定义为全局变量  
                  	this.columns = [/*{
                        header: '考核状态',
                        dataIndex: 'c.auditing_State',
                        width: 80,
                        //sortable: false,
                        renderer: function(v, meta, record){
                        	meta.style="padding-bottom: 0px;padding-top: 0px;line-height: 19px;padding-left: 0px;";
                            var text = "",tipText="";
                            if (v == 3) {
                            	tipText="未参训";
                            	text= '<div style="border-left:5px solid white;height:19px;padding-left:2px;">未参训</div>';
                            }
                            else if (v == 1) {
                            	text= '<div style="border-left:5px solid green;height:19px;padding-left:2px;">合格</div>';
                            	tipText="合格";
                            }else if (v == 2) {
                            	tipText="点击查看驳回原因";
                            	text= '<div style="border-left:5px solid red;height:19px;cursor: pointer;padding-left:2px;"><span style="cursor: pointer;color:blue;">不合格</span></div>';
                            }else if(v == 4){
                            	tipText="待考核";
                            	text= '<div style="border-left:5px solid white;height:19px;padding-left:2px;">待考核</div>';
                            }else if(v == 5){
                            	tipText="报名通过（撤销未通过）";
                            	text= '<div style="border-left:5px solid green;height:19px;padding-left:2px;">报名通过(<span style="cursor: pointer;color:blue;">撤销未通过</span>)</div>';
                            }
                            meta.tdAttr = 'data-qtip="' + tipText + '" auditStatus=' + record.get("t.auditingState") + ' classUserId=' + record.get("classUserId") + ' userId=' + record.get("userId");
                            return text;
                        },
                		listeners: {
                			click: function(g, clm){
//                				var userId = clm.getAttribute("userId");
                				var auditStatus = clm.getAttribute("auditStatus");
                				var classUserId = clm.getAttribute("classUserId");
                				if(auditStatus == 5){
                					var win = Ext.create('PJ.view.registrationmanagement.CheckEdit', {
                    					title: "查看驳回原因",
                    					flag:4,
                    					grid: me,
                    					isDisable:false,
                    					isReadOnly:true
                    				}).show();
                    				var actionName = "load";
                    				if(gj_onlineLearning_constant.loadType == "jsonp"){
                    					actionName = "loadJsonp";
                    				}
                    				win.down("form").getForm().doAction(actionName,{
                    					url:me.store.findRejectReasonUrl,
                    					params:{
                    						classUserId: classUserId
                    					},
                    					success:function(f,action){
                    					}
                    				});
                				}else if(auditStatus == 2){
                					var win = Ext.create('PJ.view.trainingmanagement.CheckEdit', {
                    					title: "查看驳回原因",
                    					flag:4,
                    					grid: me,
                    					isDisable:false,
                    					isReadOnly:true
                    				}).show();
                    				var actionName = "load";
                    				if(gj_onlineLearning_constant.loadType == "jsonp"){
                    					actionName = "loadJsonp";
                    				}
                    				win.down("form").getForm().doAction(actionName,{
                    					url:me.store.findCommentUrl,
                    					params:{
                    						classUserId: classUserId
                    					},
                    					success:function(f,action){
                    					}
                    				});
                				}else{
                					return;
                				}
                			}
                		}
                    },*/{
                    	header: '学员帐号',
                    	dataIndex: 'bu.login_id',
                    	width: 70
                    },{
                    	header: '姓名',
                    	dataIndex: 'bu.user_name',
                    	width: 70,
                		renderer: function(value, metaData, record){
                			metaData.tdAttr = 'data-qtip="' + value + '"';
                			return value;
//                			metaData.style = "white-space:normal;cursor: pointer;color:blue;";
//                			metaData.tdAttr = "data-qtip='" + value + "' userId=" + record.get("userId") + ' userName=' + record.get("bu.user_Name") + ' loginId=' + record.get("bu.login_ID")
//                								+ ' depname=' + record.get("d.depname") + ' rank=' + record.get("rank") + ' dutyLevelCode=' + record.get("dutyLevelCode");
//                			return value;
                		}
                    }, {
                        header: '性别',
                        dataIndex: 'bu.sex_code',
                        width: 45
                    },/* {
                        header: '出生年月',
                        dataIndex: 'birthdayStr',
                        width: 70,
                        renderer: function(value, meta, record){
                            meta.tdAttr = 'data-qtip="' + value + '"';
                            return value;
                        }
                    }, {
                        header: '民族',
                        dataIndex: 'bu.folk_Code',
                        width: 60,
                        renderer: function(value, meta, record){
                            meta.tdAttr = 'data-qtip="' + value + '"';
                            return value;
                        }
                    },*//*{
                        header: '已考核/待考核',
                        dataIndex: 'lockNum',
                        width: 90,
                        renderer: function(value, meta, record){
                        	meta.style = "cursor: pointer;color:blue;";
                        	meta.tdAttr = "data-qtip='" + value + "' userId=" + record.get("userId") + ' userName=' + record.get("bu.user_Name") + ' loginId=' + record.get("bu.login_ID")
							+ ' depname=' + record.get("d.depname") + ' rank=' + record.get("rank") + ' dutyLevelCode=' + record.get("dutyLevelCode");
                			return value;
                        },
                    	listeners: {
                  			click: function(g, clm){
                  				var userId = clm.getAttribute("userId");
                  				var userName = clm.getAttribute("userName");
                  				var loginId = clm.getAttribute("loginId");
                  				var depname = clm.getAttribute("depname");
                  				var rank = clm.getAttribute("rank");
                  				var dutyLevelCode = clm.getAttribute("dutyLevelCode");
                  				var currentScopeDepid = $('#selectScope').find("option:selected")[0].value;
                  				win = Ext.create('PJ.view.trainingmanagement.UserSumWindow', {
        							grid: this,
        							title: "查看详情",
        							width: 1077,
        							height: 590,
        							searchUserId: userId,
        							userName: userName,
                  					loginId: loginId,
                  					depname: depname,
                  					rank: rank,
                  					currentScopeDepid: currentScopeDepid,
                  					dutyLevelCode: dutyLevelCode
        						}).show();
                  			}
                  		}
                    },*/ {
                        header: '单位',
                        dataIndex: 'bd.depname',
                        flex:1,
                        minWidth: 150,
                        renderer: function(value, meta, record){
                            meta.tdAttr = 'data-qtip="' + value + '"';
                            return value;
                        }
                    },{
                    	header: '提任时间',
                    	dataIndex: 'bu.officeholding_date',
                    	width: 80,
                    	renderer: function(value, meta, record){
                    		meta.tdAttr = 'data-qtip="' + value + '"';
                    		return value;
                    	}
                    },{
                        header: '职级',
                        dataIndex: 'bu.duty_Level_Code',
                        flex:1,
                        minWidth: 155,
                        renderer: function(value, meta, record){
                            meta.tdAttr = 'data-qtip="' + value + '"';
                            return value;
                        }
                    },{
                    	header: '年度',
                    	dataIndex: 'uct.hour_year',
                    	width: 50,
                    	renderer: function(value, meta, record){
                    		meta.tdAttr = 'data-qtip="' + value + '"';
                    		return value;
                    	}
                    },{
                        header: '中央调训',
                        dataIndex: 'uct.zhongydx_Hour',
                    	width: 75,
                        renderer: function(value, meta, record){
                        	meta.style = "white-space:normal;cursor: pointer;color:blue;";
                            meta.tdAttr = 'data-qtip="' + value + '" userId="'+record.get('userId')+'" hourYear="'+record.get('uct.hour_year')+'"';
                            return value;
                        },
                        listeners: {
                  			click: function(g, clm){
                  				var me=this;
                  				Ext.create('AM.default.DefaultWindowView', {
                                    title: "查看参与的培训",
                                    height:450,
                                    width: 1255,
                                    grid: me,
        							searchClassType: 'zhongydx',
        							searchUserId:clm.getAttribute("userId"),
        							searchYear:clm.getAttribute("hourYear"),
                                    items: [{
                                        xtype: 'trainingmanagementAuditClassListAlert'
                                    }]
                                });
                  			}
                  		}
                    },{
                        header: '主体班',
                        dataIndex: 'uct.zhutb_Hour',
                    	width: 60,
                        renderer: function(value, meta, record){
                        	meta.style = "white-space:normal;cursor: pointer;color:blue;";
                            meta.tdAttr = 'data-qtip="' + value + '" userId="'+record.get('userId')+'" hourYear="'+record.get('uct.hour_year')+'"';
                            return value;
                        },
                        listeners: {
                  			click: function(g, clm){
                  				var me=this;
                  				Ext.create('AM.default.DefaultWindowView', {
                                    title: "查看参与的培训",
                                    height:450,
                                    width: 1255,
                                    grid: me,
        							searchClassType: 'zhutb',
        							searchUserId:clm.getAttribute("userId"),
        							searchYear:clm.getAttribute("hourYear"),
                                    items: [{
                                        xtype: 'trainingmanagementAuditClassListAlert'
                                    }]
                                });
                  			}
                  		}
                    },{
                        header: '境外培训',
                        dataIndex: 'uct.jwpx_Hour',
                    	width: 65,
                        renderer: function(value, meta, record){
                        	meta.style = "white-space:normal;cursor: pointer;color:blue;";
                            meta.tdAttr = 'data-qtip="' + value + '" userId="'+record.get('userId')+'" hourYear="'+record.get('uct.hour_year')+'"';
                            return value;
                        },
                        listeners: {
                  			click: function(g, clm){
                  				var me=this;
                  				Ext.create('AM.default.DefaultWindowView', {
                                    title: "查看参与的培训",
                                    height:450,
                                    width: 1255,
                                    grid: me,
        							searchClassType: 'jwpx',
        							searchUserId:clm.getAttribute("userId"),
        							searchYear:clm.getAttribute("hourYear"),
                                    items: [{
                                        xtype: 'trainingmanagementAuditClassListAlert'
                                    }]
                                });
                  			}
                  		}
                    },{
                        header: '专题班',
                        dataIndex: 'uct.ztb_Hour',
                    	width: 60,
                        renderer: function(value, meta, record){
                        	meta.style = "white-space:normal;cursor: pointer;color:blue;";
                            meta.tdAttr = 'data-qtip="' + value + '" userId="'+record.get('userId')+'" hourYear="'+record.get('uct.hour_year')+'"';
                            return value;
                        },
                        listeners: {
                  			click: function(g, clm){
                  				var me=this;
                  				Ext.create('AM.default.DefaultWindowView', {
                                    title: "查看参与的培训",
                                    height:450,
                                    width: 1255,
                                    grid: me,
        							searchClassType: 'ztb',
        							searchUserId:clm.getAttribute("userId"),
        							searchYear:clm.getAttribute("hourYear"),
                                    items: [{
                                        xtype: 'trainingmanagementAuditClassListAlert'
                                    }]
                                });
                  			}
                  		}
                    },{
                        header: '其他',
                        dataIndex: 'uct.qit_Hour',
                    	width: 50,
                        renderer: function(value, meta, record){
                        	meta.style = "white-space:normal;cursor: pointer;color:blue;";
                            meta.tdAttr = 'data-qtip="' + value + '" userId="'+record.get('userId')+'" hourYear="'+record.get('uct.hour_year')+'"';
                            return value;
                        },
                        listeners: {
                  			click: function(g, clm){
                  				var me=this;
                  				Ext.create('AM.default.DefaultWindowView', {
                                    title: "查看参与的培训",
                                    height:450,
                                    width: 1255,
                                    grid: me,
        							searchClassType: 'qit',
        							searchUserId:clm.getAttribute("userId"),
        							searchYear:clm.getAttribute("hourYear"),
                                    items: [{
                                        xtype: 'trainingmanagementAuditClassListAlert'
                                    }]
                                });
                  			}
                  		}
                    },{
                        header: '在线学时',
                        dataIndex: 'uct.zx_Hour',
                    	width: 65,
                        renderer: function(value, meta, record){
                            meta.tdAttr = 'data-qtip="' + value + '"';
                            return value;
                        }
                    },{
                        header: '在线折算学时',
                        dataIndex: 'uct.zxZs_Hour',
                    	width: 90,
                        renderer: function(value, meta, record){
                            meta.tdAttr = 'data-qtip="' + value + '"';
                            return value;
                        }
                    },{
                        header: '合计',
                        dataIndex: 'uct.hours',
                    	width: 50,
                        renderer: function(value, meta, record){
                            meta.tdAttr = 'data-qtip="' + record.get("hourYear") + '年"';
                            if (record.get("isStandard") == 1)
                				meta.style = "color:blue;";
                            else if (record.get("isStandard") == 2)
                				meta.style = "color:red;";
                            return value;
                        }
                    }];
                  this.store = Ext.create('PJ.'+ prototype +'.trainingmanagement.AuditUserList',{
                  	isLoad: true,
                  	listeners:{
                  		load:function(records, options, success,eOpts){
                  			if(!success){
                  				Ext.Msg.show({
                                    title: '提示',
                                    msg: '查询条件不正确，请检查后重新查询！',
                                    icon: Ext.Msg.WARNING,
                                    buttons: Ext.Msg.OK
                                });
                	    	}
                  		}
                  	}
                  });
                  this.callParent(arguments);
                  this.loadType = gj_onlineLearning_constant.loadType;//加载方式
               	},
                //发送
              	onAddMsgClick:function(){
                      var me = this;
                      var record=me.getSelectionModel().getSelection();
                  	var classId = record[0].get("classId");
                  	var className = record[0].get("t.className");
              		if(this.getSelectionModel().getCount() > 1){
                          Ext.Msg.show({
                              title: '提示',
                              msg: '操作时只可选中一条记录！',
                              icon: Ext.Msg.WARNING,
                              buttons: Ext.Msg.OK
                          });
                      	return;
                      }
              		win = Ext.create('PJ.view.messagemanagement.Edit', {
                      	title: "新增发送消息",
                      	width: 520,
                      	height:330,
                      	typeCode:1,
                      	classId:classId,
                      	flagStr:"class",
                      	grid: me
                      }).show();
              		win.down('panel').getForm().findField("defaultValue").setValue(className);
              		win.down('panel').getForm().findField("newsTypeCode").setValue("xxlx_pxb");
                  },
              	//新增
              	onAddClick:function(){
                      var me = this;
                      var classValue="";
                      Ext.Ajax.request({
                          url: 'module/trainingclass/preAddTraining2.json',
                          method: 'GET',
                          //async :  true,
                          success: function (response, options) {
                        	  
                              classValue=JSON.parse(response.responseText);
                              var selectScopeStr =classValue.sponsorName;
                              var selectScopeId=classValue.sponsorID;
//                              var classNum=classValue.classNum;
//                              var selectScopeStr = $(document.getElementById("selectScope")).find("option:selected").text();
//                              var selectScopeId=$(document.getElementById("selectScope")).find("option:selected")[0].value;
                              Ext.create('PJ.view.trainingmanagement.Add',{
                              	title: "新增培训班",
                                flag:1,
                              	grid: me,
                              	isDisable:true,
                              	isReadOnly:false,
                              	selectScopeStr:selectScopeStr,
                              	selectScopeId:selectScopeId,
//                              	classNum:classNum
                              });
                          },
                          failure: function (response, options) {
                              Ext.MessageBox.alert('失败', '请求超时或网络故障,错误编号：' + response.status);
                          }
                      });
                  },
              	//修改
              	onUpdateClick:function(){
              		var me = this;
              		var record=me.getSelectionModel().getSelection();
                  	var classId = record[0].get("classId");
              		if(this.getSelectionModel().getCount() > 1){
                          Ext.Msg.show({
                              title: '提示',
                              msg: '操作时只可选中一条记录！',
                              icon: Ext.Msg.WARNING,
                              buttons: Ext.Msg.OK
                          });
                      	return;
                      }
              		if(record[0].get("t.lockState")==1){
              			Ext.Msg.show({
                              title: '提示',
                              msg: '已审核的信息不允许再进行修改操作!',
                              icon: Ext.Msg.WARNING,
                              buttons: Ext.Msg.OK
                          });
                      	return;
              		}
                      win = Ext.create('PJ.view.trainingmanagement.Edit', {
                      	title: "更新培训班",
                          flag:2,
                      	grid: me,
                      	isDisable:true,
                      	classId:classId,
                      	isReadOnly:false
                      }).show();
              		var actionName = "load";
              		if(gj_onlineLearning_constant.loadType == "jsonp"){
              			actionName = "loadJsonp";
              		}
              		win.down("form").getForm().doAction(actionName,{
                  		url:me.store.preUpdateUrl,
                  		params:{
                  			classId: classId
                  		},
                  		success:function(f,action){
                  			var data = action.response.responseText;
                  			var json = gj_onlineLearning_constant.loadType=="ajax" ? Ext.decode(data, true) : action.response;
                  			var form = win.down('form');	 
                  			var baseForm = form.getForm();
                  			baseForm.findField("classNum").setValue(json.data.classNum);
                  			baseForm.findField("classNum_").setValue(json.data.classNum);
                  		}
                  	});
              	},
                  //配置课程
                  onConfigurationClick: function(button){
                  	var me = this;
                      var records = me.getSelectionModel().getSelection();
                      if (button.up("grid").getSelectionModel().getCount() > 1) {
                          Ext.Msg.show({
                              title: '警告',
                              msg: '操作时只可选中一条记录！',
                              icon: Ext.Msg.WARNING,
                              buttons: Ext.Msg.OK
                          });
                          return;
                      }else {
                      	win = Ext.create('PJ.view.trainingmanagement.ConfigurationCourseEdit',{
                          	title: "配置课程",
                          	grid: me,
                          	classId: records[0].get("classId")
                          }).show();
                  		var actionName = "load";//默认使用非JSONP的加载方法名“load”
                          if(gj_onlineLearning_constant.loadType=="jsonp") {
                          	actionName= "loadJsonp";
                          }
                          win.down('form').getForm().doAction(actionName,{
                          	url: me.store.preUpdateUrl,
                              params: {
                              	classId: records[0].get("classId")//培训班ID
                              },
                              success:function(form,action){
                              	var data = action.response.responseText;
                      			var json = gj_onlineLearning_constant.loadType=="ajax" ? Ext.decode(data, true) : action.response;
                      			var dateStar = json.data.beginDateStr;//举办时间（开始）
                      			var dateEnd = json.data.endDateStr;//举办时间（截止）
                      			var form = win.down('form');	 
                      			var baseForm = form.getForm();
                      			baseForm.findField("learnTime").setValue(dateStar + ' 至 ' + dateEnd);
                              }
                          });
                      }
                  },
                //报名
                  onSignupClick: function(){
                  	var me = this;
                      var records = me.getSelectionModel().getSelection();
                      if(records.length > 1){
                          Ext.Msg.show({
                              title: '提示',
                              msg: '只允许操作一条数据！',
                              icon: Ext.Msg.WARNING,
                              buttons: Ext.Msg.OK
                          });
                  		return;
                  	}
                      if(records[0].get("t.lockState") == 1){
                      	Ext.Msg.show({
                              title: '提示',
                              msg: '无法对已审核的班级进行报名！',
                              icon: Ext.Msg.WARNING,
                              buttons: Ext.Msg.OK
                          });
                          return;
                      }
                     var win = Ext.create('PJ.view.unitregistrationmanagement.SignUpFrame', {
              			grid: me,
              			title: "报名",
              			width: 1200,
              			height: 650,
              			classId: records[0].get("classId"),
              			openState: records[0].get("t.openState"),
              			publishState: records[0].get("t.publishState"),
              			signUpState:1,
              			auditingState:3,
              			clickSource:2
              		}).show();
              		var actionName = "load";
                      if(gj_onlineLearning_constant.loadType=="jsonp") {
                      	actionName= "loadJsonp";
                      }
                      win.down('form').getForm().doAction(actionName,{
                      	url: me.store.configurationUrl,
                          params: {
                          	classId: records[0].get("classId")//培训班ID
                          },
                          success:function(form,action){
                          	var data = action.response.responseText;
                  			var json = gj_onlineLearning_constant.loadType=="ajax" ? Ext.decode(data, true) : action.response;
                  			var dateStar = json.data.beginDateStr;//举办时间（开始）
                  			var dateEnd = json.data.endDateStr;//举办时间（截止）
                  			var form = win.down('form');	 
                  			var baseForm = form.getForm();
                  			baseForm.findField("className").setValue(json.data.className);//班级名称
                  			baseForm.findField("learnTime").setValue(dateStar + ' 至 ' + dateEnd);
                          }
                      });
                  },
                  /**
                   * 报名审核
                   */
                  onApplicationAuditClick: function(){
              		var me = this;
              		var record = this.getSelectionModel().getSelection();
                      if(this.getSelectionModel().getCount() > 1){
                          Ext.Msg.show({
                              title: '提示',
                              msg: '操作时只可选中一条记录！',
                              icon: Ext.Msg.WARNING,
                              buttons: Ext.Msg.OK
                          });
                      	return;
                      }
    				win = Ext.create('PJ.view.trainingmanagement.UserSumWindow', {
						grid: this,
						title: "查看详情",
						width: 1077,
						height: 590,
						searchUserId: record[0].get("userId"),
						userName: record[0].get("bu.user_Name"),
      					loginId:record[0].get("bu.login_ID"),
      					depname: record[0].get("d.depname"),
      					rank: record[0].get("rank"),
      					currentScopeDepid: $('#selectScope').find("option:selected")[0].value
					}).show();
              	},
              //查看报名通过人员
                onViewSignupStatus:function(){
                	var me = this;
                	var records = me.getSelectionModel().getSelection();
                	var auditingState=new Array();
            		auditingState.push(1);
            		auditingState.push(5);
                	win = Ext.create('PJ.view.registrationmanagement.ViewSignupStatusFrame',{
                		title: "查看审核通过人员",
                		grid: me,
                		classId:records[0].get("classId"),
                		className:records[0].get("t.className"),
//                		ministrieName:records[0].get("t.ministrieName"),查看报名
                		beginDate: records[0].get("t.beginDate"),
                		endDate: records[0].get("t.endDate"),
            			clickSource:1,
            			auditingState:auditingState,
                		openState: records[0].get("t.openState")
                	}).show();
                	var actionName = "load";//默认使用非JSONP的加载方法名“load”
                    if(gj_onlineLearning_constant.loadType=="jsonp") {
                    	actionName= "loadJsonp";
                    }
                    win.down('form').getForm().doAction(actionName,{
                    	url: me.store.configurationUrl,
                        params: {
                        	classId: records[0].get("classId")//培训班ID
                        },
                        success:function(form,action){
                        	var data = action.response.responseText;
                			var json = gj_onlineLearning_constant.loadType=="ajax" ? Ext.decode(data, true) : action.response;
                			var dateStar = json.data.beginDateStr;//举办时间（开始）
                			var dateEnd = json.data.endDateStr;//举办时间（截止）
                			var form = win.down('form');	 
                			var baseForm = form.getForm();
                			
                			baseForm.findField("className").setValue(json.data.className);//班级名称
//                			baseForm.findField("trainingDeptName").setValue(json.data.ministrieName);//委托部委
                			baseForm.findField("learnTime").setValue(dateStar + ' 至 ' + dateEnd);
                        }
                    });
                },
              	
            	/**
              	 * 导出xml
              	 */
                onExportClassUserXml:function(){
              	  var me=this;
              	  var store=me.getStore();
              	  var records=me.getSelectionModel().getSelection();
              	  for(var i=0;i<records.length;i++){
              		  if(records[i].get("t.lockState")==0){
              			Ext.Msg.show({
              				  title: '提示',
              			  	  msg  : '请先审核班级再进行导出!',
              			  	  icon :Ext.Msg.WARNING,
              			  	  buttons:Ext.Msg.OK
              			  });
              			  return;
              		  }
              	  };
              	for(var i=0;i<records.length;i++){
            		  if(records[i].get("shiguanNum")<=0){
            			Ext.Msg.show({
            				  title: '提示',
            			  	  msg  : '该班级没有市管学员!',
            			  	  icon :Ext.Msg.WARNING,
            			  	  buttons:Ext.Msg.OK
            			  });
            			  return;
            		  }
            	  };
              	Ext.Msg.confirm({
            		  title:'提示',
            		  msg:'您确定要导出xml吗?',
            		  icon:Ext.Msg.WARNING,
            		  buttons:Ext.Msg.OKCANCEL,
            		  fn:function(id){
            			  if(id=='ok'){
            				  var classIds= new Array();
            				  Ext.Array.each(records,function(name,index){
            					  classIds.push("'"+name.get('classId')+"'");
//            					  classIds.push(name.get('classId'));
            				  });
            				  href=store.exportClassUserXml + "?";
                          	  href+="searchUpdateClassIds=" + classIds;
                              href = encodeURI(href);
                              var atag = Ext.get("exportResume");
                              atag.set({
                                  "href": href
                              });
                              atag.dom.click();
            			  }
            		  }
            	  });
            	},
              	
                  //导出 -- 判断按钮是否可以操作
                  ifSelect: function(selectType, exportUrl, classId, urlExportId){
                  	var records = this.getSelectionModel().getSelection();
                  	if(selectType=='course'){
                  		if(records.length == 0){
                  			Ext.Msg.show({
                  				title: '提示',
                  				msg: '请选择一条数据进行操作！',
                  				icon: Ext.Msg.WARNING,
                  				buttons: Ext.Msg.OK
                  			});
                  			return;
                  		}
                  		if(records.length > 1){
                  			Ext.Msg.show({
                  				title: '提示',
                  				msg: '只允许操作一条数据！',
                  				icon: Ext.Msg.WARNING,
                  				buttons: Ext.Msg.OK
                  			});
                  			return;
                  		}
                  	}
                      var atag = Ext.get("exportResume");
                      var exportUrlStr = Ext.isEmpty(urlExportId)?exportUrl:exportUrl + '?'+ urlExportId + '=' + classId;
                  	atag.set({
                  		"href": exportUrlStr
                  	});
                      atag.dom.click();
                  
                  },
                /*//导入名额
                  onImportquotasClick: function(){
              		var me = this;
                  	Ext.create("PJ.view.quotamanagement.BatchImportEdit", {
              			title: "导入名额",
              			height: 110,
              			width: 380,
              			grid: me
              		}).show();
                  },*/
                  /**
                   * 计划名额
                   */
                  onPlanplacesClick: function(){
              		var me = this;
              		var record = this.getSelectionModel().getSelection();
                      if(this.getSelectionModel().getCount() > 1){
                          Ext.Msg.show({
                              title: '提示',
                              msg: '操作时只可选中一条记录！',
                              icon: Ext.Msg.WARNING,
                              buttons: Ext.Msg.OK
                          });
                      	return;
                      }
              		Ext.create('AM.default.DefaultWindowView', {
                          title: record[0].get("t.className"),
                          height:550,
                          width: 450,
                          grid: me,
                          classId:record[0].get("classId"),
                          items: [{
                              xtype: 'planPlacesList'
                          }],
                          listeners: {
                          	close: function(){
                          		me.getStore().load();
                          	}
                          }
                      });
              	},
                  //预览
                  listeners: {
//              		selectionchange: function(selModel, selected){
//              			this.down('#' + this.oldId + "Configuration").setDisabled(selected.length === 0);//配置课程
//              		},
              		viewready: function(){
              			var me = this;
              			//导出按钮集合
                      	var exportMenu = Ext.create('Ext.menu.Menu', {
                              items: [{
                                text: '导出全部学员',
              	        		iconCls: 'banjiIco',
                                  listeners: {
                                      click: function(btn){
                                    	var me=this;
                                    	var ele=me.up('trainingmanagementAuditUserList');
                                  		var depid=ele.up().depid
                                  		var store=ele.getStore();
                              			href=store.exportUnqualifiedUserListExcel + "?searchDepId="+depid;
                              			var para=store.getProxy().extraParams;
                              			if(para.searchBeginDate){
                              				href+='&searchBeginDate='+para.searchBeginDate;
                              			}
                              			if(para.searchEndDate){
                              				href+='&searchEndDate='+para.searchEndDate;
                              			}
                                  		href = encodeURI(href);
                                  		var atag = Ext.get("exportResume");
                                  		atag.set({
                                  			"href": href
                                  		});
                                        atag.dom.click();
                                  	}
                                  }
                              }, {
                                  text: '导出已达标学员',
                	        		iconCls: 'qiandaoIco',
                                    listeners: {
                                    	click: function(btn){
                                        	var me=this;
                                        	var ele=me.up('trainingmanagementAuditUserList');
                                      		var depid=ele.up().depid
                                      		var store=ele.getStore();
                                  			href=store.exportUnqualifiedUserListExcel + "?isStandard=1&searchDepId="+depid;
                                  			var para=store.getProxy().extraParams;
                                  			if(para.searchBeginDate){
                                  				href+='&searchBeginDate='+para.searchBeginDate;
                                  			}
                                  			if(para.searchEndDate){
                                  				href+='&searchEndDate='+para.searchEndDate;
                                  			}
                                      		href = encodeURI(href);
                                      		var atag = Ext.get("exportResume");
                                      		atag.set({
                                      			"href": href
                                      		});
                                            atag.dom.click();
                                    	}
                                    }
                                },{
                                text: '导出未达标学员',
              	        		iconCls: 'courseinfoIco',
                                  listeners: {
                                  	click: function(btn){
                                    	var me=this;
                                    	var ele=me.up('trainingmanagementAuditUserList');
                                  		var depid=ele.up().depid
                                  		var store=ele.getStore();
                              			href=store.exportUnqualifiedUserListExcel + "?isStandard=2&searchDepId="+depid;
                              			var para=store.getProxy().extraParams;
                              			if(para.searchBeginDate){
                              				href+='&searchBeginDate='+para.searchBeginDate;
                              			}
                              			if(para.searchEndDate){
                              				href+='&searchEndDate='+para.searchEndDate;
                              			}
                                  		href = encodeURI(href);
                                  		var atag = Ext.get("exportResume");
                                  		atag.set({
                                  			"href": href
                                  		});
                                        atag.dom.click();
                                  	}
                                  }
                              }]
                          });
              			this.addDocked([{
              				dock: 'top',
              				xtype: "searchform",
              				columnCount: 3,
                            fieldDefaults: {
                                xtype: "combo",
                                emptyText: "请选择",
                                editable: false,
                                queryMode: 'local',//'remote',//数据类型
                                valueField: 'value',
                                displayField: 'text',
                                labelAlign: 'right',
                                labelWidth: 100,
                                maxLength: 100
                            },
              				items: [{
                                xtype: "textfield",
                                name: "searchLoginID",
                				labelAlign: 'right',
                                emptyText: '请输入学员账号',
                                fieldLabel: '账号'
                            },{
                                xtype: "textfield",
                                name: "searchUserName",
                				labelAlign: 'right',
                                emptyText: '请输入姓名',
                                fieldLabel: '姓名'
                            },{
                                fieldLabel: "性别",
                                emptyText: '请选择',
                                name: "searchSexCode",
                                store: Ext.create("Ext.data.ArrayStore", {
                					fields: ['value', 'text'],
                					data: [[1078, '男'], [1079, '女']]
                				})
                            },{
                                fieldLabel: "年份",
                                emptyText: '请选择',
//                    			columnWidth: .33,
                                name: "searchYear",
                                store: Ext.create("Ext.data.ArrayStore", {
                					fields: ['value', 'text'],
                					data: [[2013, '2013'], [2014, '2014'], [2015, '2015'], [2016, '2016'], [2017, '2017'], [2018, '2018'], [-1, '不限']]
                				})
                            }, {
                            	fieldLabel: "职级",
                                name: "dutyLevelId",
                                emptyText: '请选择',
//                    			columnWidth: .33,
                                labelAlign: 'right',
                                store: Ext.create("Ext.data.ArrayStore", {
                					fields: ['value','text'],
                					data: [['1380', '厅局级正职（巡视员）'], ['1381', '厅局级副职（副巡视员）'], ['1382', '县处级正职（调研员）'],['1383','县处级副职（副调研员）'],['1384','乡科级副职（副主任科员）'],['1385','乡科级副职（副主任科员）'],['1386','科员'],['1387','办事员'],['1388','退休'],['1424','未定职公务员']]
                				}),
                                emptyText: "请选择"
                            }, {
                            	fieldLabel: "是否参与培训班",
                            	name: "isTrainingClass",
                            	emptyText: '请选择',
//                    			columnWidth: .34,
                            	labelAlign: 'right',
                            	store: Ext.create("Ext.data.ArrayStore", {
                            		fields: ['value','text'],
                            		data: [['1', '是'], ['2', '否']]
                            	}),
                            	emptyText: "请选择"
                            }, {
                  				xtype: 'defaultDate',
                  				fieldLabel: '提任时间',
                  				name: 'searchOfficeholdingDate',
                  				emptyText: "请输入提任时间"
                  			},{
                  				xtype: 'defaultDate',
                  				fieldLabel: '开班时间',
                  				name: 'searchBeginDate',
                  				id: 'searchTrainingManagementSD2',
                  				vtype: 'startLessEndDate',
                  				startLessEndDate: {
                  					targetCmpId: 'searchTrainingManagementED2',
                  					isStart: true
                  				},
                  				emptyText: "请输入开班时间"
                  			},{
                  				xtype: 'defaultDate',
                  				fieldLabel: '至:',
                  				labelSeparator: '',
                  				name: 'searchEndDate',
                  				id: 'searchTrainingManagementED2',
                  				vtype: 'startLessEndDate',
                  				vtypeText: '结束时间不能早于开始时间！',
                  				startLessEndDate: {
                  					targetCmpId: 'searchTrainingManagementSD2',
                  					isStart: false
                  				},
                  				emptyText: "请输入结业时间"
                  			},{
                                xtype: "textfield",
                                name: "searchDeptName",
                				labelAlign: 'right',
                                emptyText: '请输入单位名称',
                                fieldLabel: '单位名称'
                            },{
                            	fieldLabel: "学时小于110学时",
                                name: "isStandard",
                                emptyText: '请选择',
                                labelAlign: 'right',
                                store: Ext.create("Ext.data.ArrayStore", {
                					fields: ['value','text'],
                					data: [['2', '是'],['1', '否']]
                				}),
                                emptyText: "请选择"
                            }]/*,
                  			onSelectClick : function(btn) {
                				var form = this;
                				if (form.grid) {
                					if (!form.getForm().isValid()) {
                						return;
                					}
                					var newParams = form.getValues();
                					
                					var forms=Ext.ComponentQuery.query("searchform");
                					//获取高级查询form并将查询条件赋予简单查询
                					var otherParams = forms[1].getValues();
                					Ext.apply(newParams,otherParams);
                					
                					var store = form.grid.getStore();
                					// 重置翻页属性
                					form.grid.resetPage();
                					// 4.0强制更改store参数写法
                					var params = store.proxy.extraParams;
                					Ext.apply(params, newParams);
                					store.load({
                						scope: form,
                						callback: function(records, operation, success){
                							if(success){
                								this.onAfterSearch(form);
                							}
                						}
                					});
                				} else {
                					Ext.Msg.show({
                								title : orchid_lang.promptWindowInfo.warningTitle,
                								msg : default_lang.defaultList.selectWarningMsg,
                								icon : Ext.Msg.WARNING,
                								buttons : Ext.Msg.OK
                							});
                				}
                			},
                			onResetClick: function(button){
                				var form=this;
                                var gridPanel = form.grid;
            					var forms=Ext.ComponentQuery.query("searchform");
                                var newParams = {
                                		searchDepId: form.grid.getStore().proxy.extraParams.searchDepId,
                                };
                                var params = form.grid.getStore().proxy.extraParams={};
                                Ext.apply(params, newParams);
                                form.getForm().reset();
                                forms[1].getForm().reset();
                            }*/,
              				grid: this
              			}/*,{
              				dock: 'top',
              				xtype: "searchform",
//              				collapsedFieldSet:true,
              				title:"高级查询",
              				columnCount: 4,
                            fieldDefaults: {
                                xtype: "combo",
                                emptyText: "请选择",
                                editable: false,
                                queryMode: 'local',//'remote',//数据类型
                                valueField: 'value',
                                displayField: 'text',
                                labelAlign: 'right',
                                labelWidth: 120,
                                maxLength: 100
                            },
              				items: [{
                            	fieldLabel: "非",
                            	name: "judgeOne",
                            	emptyText: '请选择',
                    			columnWidth: .2,
                            	labelAlign: 'right',
                            	store: Ext.create("Ext.data.ArrayStore", {
                            		fields: ['value','text'],
                            		data: [['3', '非']]
                            	}),
                            	emptyText: "请选择"
                            },{
                            	fieldLabel: "学时小于110学时",
                                name: "isStandard",
                                emptyText: '请选择',
                    			columnWidth: .3,
                                labelAlign: 'right',
                                store: Ext.create("Ext.data.ArrayStore", {
                					fields: ['value','text'],
                					data: [['2', '是'],['1', '否']]
                				}),
                                emptyText: "请选择"
                            },{
                            	 xtype: "text",
                                 columnWidth:1
                            },{
	                           	 xtype: "text",
	                             columnWidth:.2
                            },{
                            	fieldLabel: "与或",
                            	name: "judgeTwo",
                            	emptyText: '请选择',
                    			columnWidth: .3,
                            	labelAlign: 'right',
                            	store: Ext.create("Ext.data.ArrayStore", {
                            		fields: ['value','text'],
                            		data: [['1', '与'], ['2', '或']]
                            	}),
                            	emptyText: "请选择"
                            },{
	                           	 xtype: "text",
	                             columnWidth:1
                            },{
                            	fieldLabel: "非",
                            	name: "judgeThree",
                            	emptyText: '请选择',
                    			columnWidth: .2,
                            	labelAlign: 'right',
                            	store: Ext.create("Ext.data.ArrayStore", {
                            		fields: ['value','text'],
                            		data: [['3', '非']]
                            	}),
                            	emptyText: "请选择"
                            },{
                                xtype: "textfield",
                                name: "searchDeptName",
                                columnWidth:.3,
                				labelAlign: 'right',
                                emptyText: '请输入部门名称',
                                fieldLabel: '部门名称'
                            },{
	                           	 xtype: "text",
	                             columnWidth:1
                            },{
	                           	 xtype: "text",
	                             columnWidth:.2
                            },{
                            	fieldLabel: "与或",
                            	name: "judgeFour",
                            	emptyText: '请选择',
                    			columnWidth: .3,
                            	labelAlign: 'right',
                            	store: Ext.create("Ext.data.ArrayStore", {
                            		fields: ['value','text'],
                            		data: [['1', '与'], ['2', '或']]
                            	}),
                            	emptyText: "请选择"
                            },{
	                           	 xtype: "text",
	                             columnWidth:1
                            },{
                            	fieldLabel: "非",
                            	name: "judgeFive",
                            	emptyText: '请选择',
                    			columnWidth: .2,
                            	labelAlign: 'right',
                            	store: Ext.create("Ext.data.ArrayStore", {
                            		fields: ['value','text'],
                            		data: [['3', '非']]
                            	}),
                            	emptyText: "请选择"
                            },{
                  				xtype: 'defaultDate',
                  				fieldLabel: '开班时间',
                    			columnWidth: .3,
                  				name: 'searchBeginDate',
                  				id: 'searchTrainingManagementSD',
                  				vtype: 'startLessEndDate',
                  				startLessEndDate: {
                  					targetCmpId: 'searchTrainingManagementED',
                  					isStart: true
                  				},
                  				emptyText: "请输入开班时间"
                  			},{
                  				xtype: 'defaultDate',
                  				fieldLabel: '至:',
                    			columnWidth: .3,
                  				labelSeparator: '',
                  				name: 'searchEndDate',
                  				id: 'searchTrainingManagementED',
                  				vtype: 'startLessEndDate',
                  				vtypeText: '结束时间不能早于开始时间！',
                  				startLessEndDate: {
                  					targetCmpId: 'searchTrainingManagementSD',
                  					isStart: false
                  				},
                  				emptyText: "请输入结业时间"
                  			}],
                  			onSelectClick : function(btn) {
                				var form = this;
                				if (form.grid) {
                					if (!form.getForm().isValid()) {
                						return;
                					}
                					var newParams = form.getValues();
                					
                					var forms=Ext.ComponentQuery.query("searchform");
                					//获取简单查询form并将查询条件赋予高级查询
                					var otherParams = forms[0].getValues();
                					Ext.apply(newParams,otherParams);
                					
                					var store = form.grid.getStore();
                					// 重置翻页属性
                					form.grid.resetPage();
                					// 4.0强制更改store参数写法
                					var params = store.proxy.extraParams;
                					Ext.apply(params, newParams);
                					store.load({
                						scope: form,
                						callback: function(records, operation, success){
                							if(success){
                								this.onAfterSearch(form);
                							}
                						}
                					});
                				} else {
                					Ext.Msg.show({
                								title : orchid_lang.promptWindowInfo.warningTitle,
                								msg : default_lang.defaultList.selectWarningMsg,
                								icon : Ext.Msg.WARNING,
                								buttons : Ext.Msg.OK
                							});
                				}
                			},
                			onResetClick: function(button){
                				var form=this;
                                var gridPanel = form.grid;
            					var forms=Ext.ComponentQuery.query("searchform");
                                var newParams = {
                                		searchDepId: form.grid.getStore().proxy.extraParams.searchDepId,
                                };
                                var params = form.grid.getStore().proxy.extraParams={};
                                Ext.apply(params, newParams);
                                form.getForm().reset();
                                forms[0].getForm().reset();
                            },
              				grid: this
              			}*/,{
              				xtype: 'toolbar',
              				dock: 'top',
              				displayInfo: true,
              				items: [/*this.addButton, "-", this.updateButton, "-", */
	      				     /* {
	                              text: '查看详情',
	                              iconCls: 'applicationAuditIco',
	                              itemId: this.oldId + "ApplicationAudit",
	                              disabled: true,
	                              scope: this,
	                              handler: this.onApplicationAuditClick
	                          },"-",*/,{
                                  text: '导出',
                                	xtype: 'button',
                                    cls: 'floater',
                                    textAlign: 'right',
                                    arrowAlign: 'right',
                                    itemId: this.oldId + 'Export',
                                    enableToggle: true,
                                    iconAlign: 'left',
                                    iconCls: 'deriveIco',
                                    pressedCls: 'x-btn-focus',
                                    menuActiveCls: 'x-btn-menu-active',
                                    menu: exportMenu
                				}/*,"->", this.countSelectPanel*/]
              			}]);
                      // 触发权限过滤事件
                      me.fireEvent("permission", this);
              		}
                  }
              });